import { query } from '../db'

export interface Resume {
  id: number
  name: string
  title: string
  email: string
  phone: string
  location: string
  website: string
  github: string
  linkedin: string
  summary: string
  skills: {
    frontend: string[]
    backend: string[]
  }
  education: Array<{
    degree: string
    school: string
    type: string
    period: string
  }>
  experience: Array<{
    title: string
    company: string
    period: string
    description: string[]
  }>
  projects: Array<{
    title: string
    tech: string[]
    description: string[]
  }>
  languages?: Array<{
    name: string
    level: string
  }>
  certificates?: Array<{
    name: string
    issuer: string
    date: string
  }>
  status: number
  created_at: string
  updated_at: string
}

// 获取简历信息
export async function getResume(): Promise<Resume | null> {
  const sql = 'SELECT * FROM blog_resume WHERE status = 1 LIMIT 1'
  const resumes = await query(sql) as Resume[]
  
  if (resumes.length === 0) return null
  
  const resume = resumes[0]
  return {
    ...resume,
  }
} 